//    Copyright (C) Kherty.  All rights reserved.
using System.Collections.Generic;
using OpenLS.Core.Serialization;

namespace OpenLS.Drawing.Diagram
{
    internal class Categories : IOfficeXmlSerializable
    {
        List<Category> _categories = new List<Category>();
        public void ReadXml(ReadContext context)
        {
            using (var c = context.Read("catLst"))
            {
                _categories.Clear();
                _categories.AddRange(c.ReadOptionalWhile<Category>("cat"));
            }

        }

        public void WriteXml(WriteContext context)
        {
            using (var c = context.Write("catLst"))
            {
                c.WriteElements(_categories);
            }

        }
    }
}